<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>商品编辑</title>
  <link th:href="@{/local/css/goodsAdd.css}" rel="stylesheet">
</head>
<body>
<div>
  <div id="top" th:include="head.html"></div>
  <div id="middle">
    <div id="left" th:include="left.html::left"></div>
    <div id="right">
      <div id="msg" th:text="${msg}"></div>
      <form id="editGoods" action="/admin/hyqeditGoods" method="post">
        <input type="hidden" name="id" th:value="${edit.getId()}">
        <table id="addTable">
          <tr><th>名称</th><td><input type="text" name="name" th:value="${edit.getName()}"></td></tr>
          <tr><th>编号</th><td><input type="text"  name="code" th:value="${edit.getCode()}"></td></tr>
          <tr><th>类别</th>
            <td>
              <select name="categoryId">
                <option th:each="category:${categoryList}"
                        th:value="${category.getId()}"
                        th:text="${category.getName()}"
                        th:selected="${edit.getCategoryId()} eq ${category.getId()}">
                </option>
              </select>
            </td>
          </tr>
          <tr><th>单价</th><td><input type="number"  name="price" th:value="${edit.getPrice()}"></td></tr>
          <tr><th>库存</th><td><input type="number"  name="quantity" th:value="${edit.getQuantity()}"></td></tr>
          <tr><th>是否热销</th>
            <td>
              <input type="radio" name="hot" th:attr="checked = ${edit.getHot() == 1}" value="1">是
              <input type="radio" name="hot" th:attr="checked = ${edit.getHot() == 0}" value="0">否
            </td>
          </tr>
          <tr>
            <th>商品图片</th>
            <td>
              <div class="upload">
                <span class="plus">+</span>
                <input type="file"  id="input" accept=".jpg, .jpeg, .png">
                <input id="gdimage" type="hidden" name="image"  >
              </div>
              <img type="image" id="img" th:src="${edit.getImage()}" alt="#">
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="reset" value="重置">
              <input type="submit" value="提交">
              <input type="button"name="Submit" onclick="javascript:history.back(-1);" value="返回">
            </td>
          </tr>
        </table>
      </form>
    </div>
  </div>
  <div id="bottom" th:include="bottom.html::bottom"></div>
  <script th:src="@{/js/axios.min.js}"></script>
  <script th:src="@{/js/jquery-3.4.1.slim.min.js}"></script>
  <script th:src="@{/local/js/imageAdd.js}"></script>
</div>

</body>
</html>